import { UserService } from './../service/user.service';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {

  listData = [
    {
      title: '首页',
      url: '',
      id: 1
    },
    {
      title: '文章',
      url: '/home/article',
      id: 2
    },
    {
      title: '列表',
      url: '/home/list',
      id: 3
    },
    {
      title: '我们',
      url: '/home/about',
      id: 4
    }
  ];

  userStyle = {
    "background-color": "#f993a2"
  }

  userInfo = JSON.parse(window.localStorage.getItem('USER_TOKEN')).userInfo

  constructor(private router: Router, private user: UserService) { }

  ngOnInit() {
  }

  /** 修改个人信息 */
  editUserInfo() {
    this.router.navigateByUrl('/home/user/info')
  }

  /** 登出  */
  logoutHandel() {
    this.user.logOut()
  }
  updatePassword() {
    this.router.navigateByUrl('/home/user/password')
  }
}
